<?php
$params = array_merge(
    require(__DIR__ . '/../../common/config/params.php'),
    require(__DIR__ . '/../../common/config/params-local.php'),
    require(__DIR__ . '/params.php'),
    require(__DIR__ . '/params-local.php')
);

$config = [
    'id' => 'app-backend',
    'basePath' => dirname(__DIR__),
    'controllerNamespace' => 'backend\controllers',
    'bootstrap' => ['log'],
    'modules' => [],
    'components' => [
			'user' => array(
				'identityClass' => 'common\models\User',
				'enableAutoLogin' => false,
			),
			'authManager' => [
				'class' => 'yii\rbac\DbManager',//PhpManager',
				'defaultRoles' => ['user'], // here define your roles
				//'authFile' => '@console/data/rbac.php' //the default path for rbac.php | OLD CONFIGURATION
				// 'itemFile' => '@console/data/items.php', //Default path to items.php | NEW CONFIGURATIONS
				// 'assignmentFile' => '@console/data/assignments.php', //Default path to assignments.php | NEW CONFIGURATIONS
				// 'ruleFile' => '@console/data/rules.php',
			],
			'format'	=>	[
				'class'	=>	'yii\i18n\Formatter'
			],
			'log' => array(
				 'traceLevel' => YII_DEBUG ? 3 : 0,
				 'targets' => array(
					  array(
							'class' => 'yii\log\FileTarget',
							'levels' => array('error', 'warning')
					  )
				 )
			),
		  'db'	=>	[
				'class' => 'yii\db\Connection',
				'dsn' => 'mysql:host=localhost;dbname=yii2',
				'username' => 'mysql',
				'password' => 'mysql',
				'charset' => 'utf8',
		  ]
    ],
    'params' => $params,
];

if (!YII_ENV_TEST) {
    // configuration adjustments for 'dev' environment
    // $config['bootstrap'][] = 'debug';
    // $config['modules']['debug'] = 'yii\debug\Module';
   $config['bootstrap'][] = 'gii';
   $config['modules']['gii'] = [
		'class' => 'yii\gii\Module',
		'allowedIPs' => ['127.0.0.1', '::1', '10.43.66.*', '192.168.178.20'],
	];
}

return $config;